/**
 * Nettle Wimp utilities - generic code
 * (C) Nettle developers 2000-2002
 *
 * $Id: wimputil,v 1.7 2002/03/18 01:57:04 ijeffray Exp $
 */

#ifndef WIMPUTIL_H
#define WIMPUTIL_H

#include "nettle.h"
#include "messages.h"

/** Button enumeration for a click/drag/double click icon */
enum
{
  ClickAdjust  = 0x001 * 256,
  ClickMenu    = 0x002 * 1,
  ClickSelect  = 0x004 * 256,
  DragAdjust   = 0x001 * 16,
  DragMenu     = 0x002 * 16,
  DragSelect   = 0x004 * 16,
  DoubleAdjust = 0x001 * 1,
  DoubleSelect = 0x004 * 1
};

extern void closedown_wimp(void);

extern void generror(const char *, bool);
extern bool generror_question(const char *buttonstok, const char *formattok,int params,...);
extern void gensaveerror (FILE *, const char *);

extern void set_icon_state(int, int, int, int);
extern void set_icon_data(int, int, const char *);
extern char *read_icon_data(int, int, char *, int);

extern void set_title_bar(int, const char *);
extern void force_redraw(int,int,int,int,int);

extern void create_menu_by_icon(int *menu, int window, int icon);
extern bool win_is_open(int window_handle);
extern int get_icon_data_length(int window_handle, int icon_handle);
extern char *get_icon_validation (int window_handle, int icon_handle);
extern bool read_icon_ticked (int window_handle, int icon_handle);

extern int *create_menu(int *menu_defn, char *indirected, char *title, char *entries, ... );
extern char *get_menu_item(const char *name);
extern char *get_last_menu_item(const char *name);
extern char *get_grey_menu_item(const char *name);
extern char *get_grey_last_menu_item(const char *name);

extern void drag_start(int window_handle, int icon_handle);

/******************************************************************
 Function:     tick_menu_for_icon_text
 Description:  Ticks the menu item that matches the text in the
               icon specified
 Parameters:   menu-> the menu structure
               window = the window handle
               icon = the icon handle
 Returns:      none
 ******************************************************************/
void tick_menu_for_icon_text(int *menu, int window_handle, int icon);


#endif
